package LINE.ACT.controllerLibrary.Rest.controller;

import java.util.Map;

import javax.annotation.Resource;

import LINE.ACT.controllerLibrary.service.RestService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Handles requests for the application home page.
 */
@Controller
public class RestController {
	
	private static final Logger logger = LoggerFactory.getLogger(RestController.class);
	
	// Setting Main Service
	@Resource(name = "RESTSERVICE")
	private RestService service;
	
	/**
	 * Simply selects the home view to render by returning its name.
	 */ 
	@RequestMapping("/home.do")
	public String home(Map<String, Object> commandMap, ModelMap model) {
		return "home";
	}

	@RequestMapping("/getUser.do")
	public ModelAndView doGetUser(Map<String, Object> commandMap, ModelMap model){
			
		ModelAndView mv = new ModelAndView("jsonView");

		Object lists = service.getUserInfo(commandMap);
		mv.addObject("result", lists);

		return mv;
	} 	
}

